package mysql

import (
	"doc-manage/doc/doc"

	"gorm.io/gorm"
)

type Doc struct {
	gorm.Model
	//医生姓名
	Name string `gorm:"type:varchar(30);not null;comment:'医生姓名'"`
	//医生头像
	Image string `gorm:"type:varchar(500);not null;comment:'医生头像'"`
	//院区
	Area string `gorm:"type:varchar(30);not null;comment:'院区'"`
}

func (d *Doc) DocList(db *gorm.DB, lists []*doc.DocList) ([]*doc.DocList, error) {
	err2 := db.Debug().Model(&Doc{}).
		Select("Doc.id ad doc_id", "name", "image", "area").
		Find(&lists).Error
	return lists, err2
}

func (d *Doc) DocUpdate(db *gorm.DB) error {
	return db.Debug().Updates(d).Error
}

func (d *Doc) DocShow(db *gorm.DB) error {
	return db.Debug().Find(d).Error
}
